﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Group3.MediaTool.Core;
using Group3.MediaTool.Interface;
using Group3.Framework.Extensions;

namespace Group3.MediaTool.Core.ObjectGenerator
{
    /// <summary>
    /// @Version: 1.0
    /// @Author: Pascal Senjic
    /// 
    /// @Comment:
    ///     ObjectDefinition represents the structure for generating object relation models.
    ///     It's the plan, how these models could be build.
    /// </summary>
    public class ObjectDefinition : Group3.MediaTool.Interface.IObjectDefinition
    {
        #region MemberVariables

        private string ormName;
        private IEnumerable<IFieldDefinition> dataFields;
        #endregion

        #region Public Properties

        public string OrmName
        {
            get { return ormName; }
            set { ormName = value; }
        }
        public IEnumerable<IFieldDefinition> DataFields
        {
            get { return dataFields; }
            set { dataFields = value; }
        }
        public IEnumerable<IFieldDefinition> KeyFields
        {
            get { return DataFields.Where(itm => itm.IsKey); }
        }
        public IEnumerable<IFieldDefinition> RealtionFields
        {
            get { return DataFields.Where(itm => itm.ValueType == e_ValueType.Relation); }
        }
        #endregion
    }
}
